<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/css.css" rel="stylesheet" type="text/css" />
<title>DoRe Mon-web2</title>
</head>

<body >
    <div class="khung">
    <?php
require_once 'model/works.php';

$keyword = new Works();
$keyword->table_name = "works";
?>
<?php
if (!isset($_GET["page"]))
    $page = 1;
else
   $page = $_GET["page"];
$keywords = $keyword->select($page);
$total = $keyword->countWords();
?>
    
    <div class="menu">
        <ul>
            <li><a href="#"> TRANG CHỦ</a></li>
           <li><a href="#">GIỚI THIỆU</a></li>
            <li><a href="#"><strong>SẢN PHẨM</strong></a>
               <ul>
                 <li><a href="#">APPLE</a></li>
                 <li><a href="#">DELL</a></li>
                 <li><a href="#">SAMSUNG</a></li>
                 <li><a href="#">PANASONIC</a></li>
               </ul>
           </li>   
           
          <li><a href="#"><strong>THIẾT BỊ MẠNG</strong></a>
               <ul>
                 <li><a href="#">USB 3G</a></li>
                 <li><a href="#">HUB-SWICHT</a></li>
                 <li><a href="#">CABLE MẠNG</a></li>
                 <li><a href="#">KHÁC</a></li>
               </ul>
           </li>
            <li><a href="#"> THIẾT BỊ VĂN PHÒNG</a>
                <ul>
                 <li><a href="#">MÁY IN</a></li>
                 <li><a href="#">MÁY SCAN</a></li>
                 <li><a href="#">MÁY FAX</a></li>
                 <li><a href="#">MÁY TÍNH TIỀN</a></li>
               </ul>
            </li>
            <li><a href="#">LIÊN HỆ</a></li>
        </ul>
        </div>
        
        <div class="hinh"></div>
 
<table border="4px" style="clear: both;">
    
    <nav>
        <ul>
           <li><a href="index.php?page=1">Fist</a></li>
            <li><a href="index.php?page= <?php echo $page-1 ?>"> Prev >> </a></li>
            <?php for ($i = 1; $i <= $total / PAGE; $i++): ?>
            <li>
                <a href="index.php?page=<?php echo $i ?>">
                    <?php echo $i ?>
                </a>
            </li>
            <?php endfor; ?>
            <li><a href="index.php?page= <?php echo $page+1 ?>"> Next >> </a></li>
             <li><a href="index.php?page=10">Last</a></li>
        </ul>
    </nav>
    
    <tr  id="tr" >
        <td>Id</td>
        <td>Name</td>
        <td>Description</td>
    </tr>
    <?php foreach ($keywords as $keywords_n): ?>
        <tr>
            <td> <?php echo $keywords_n["id"] ; ?></td>
            <td><?php echo $keywords_n["name"] ; ?></td>
            <td><?php echo substr($keywords_n['description'], 0, 100) ; ?></td>
        </tr>
    <?php endforeach; ?>

</table>

    <nav>
        <ul>
           <li><a href="index.php?page=1">Fist</a></li>
            <li><a href="index.php?page= <?php echo $page - 1 ?>"> << Prev </a></li>
            <?php for ($i = 1; $i <= $total / PAGE; $i++): ?>
            <li>
                <a href="index.php?page=<?php echo $i ?>">
                    <?php echo $i ?>
                </a>
            </li>
            <?php endfor; ?>
            <li><a href="index.php?page= <?php echo $page + 1 ?>"> Next >> </a></li>
             <li><a href="index.php?page=<?php echo $total/PAGE ?>">Last</a></li>
        </ul>
    </nav>
        <div class="footer" style="color: #ffffff">Trường Cao Đẳng Công Nghệ Thủ Đức.<br>Design by Tân Đoàn Thanh.</br></div>
</div>
    
    
</body>
</html>